Genesis 37:28

37:28 So when the Midianite merchants passed by, Joseph’s brothers pulled him out of the cistern and sold him to the Ishmaelites for twenty pieces of silver. The Ishmaelites then took Joseph to Egypt.

Genesis 37:36

37:36 Now in Egypt the Midianites sold Joseph to Potiphar, one of Pharaoh’s officials, the captain of the guard.